﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AutoMapper关系映射例子
{
    public class RegisterAutoMapper
    {
        public static void Register()
        {
            Mapper.Initialize(x =>
            {
                x.CreateMap<Person, PersonDTO>().ForMember(e => e.Name, q => {
                    q.MapFrom(z => z.Name);
                });


                x.CreateMap<Student, StudentDTO>().ForMember(e => e.Description, q => {
                    q.MapFrom(z => z.Desc);
                });
            });
        }
    }
}
